package com.java.project_1;

/**
 * @author xiaoqi   Email:1404899001@qq.com
 * @Description
 * @date 2020-11-1117:17:50
 */
public class FamilyAccount {
    public static void main(String[] args) {
        boolean isFlag = true;
        String details = "收支\n\n" + "账户金额\n\n" + "收支金额\n\n" + "说明\n\n";
        while (isFlag) {
            System.out.println("------------------------------家庭收支账单软件-------------------\n");
            System.out.println("                             1收支明细");
            System.out.println("                             2收入统计");
            System.out.println("                             3支出统计");
            System.out.println("                             4退    出\n");
            System.out.print("     请选择(1~4)                   ");
            //获取用户的选择
            char selecation = Unitlity.readMeanSelecation();
            int balance = 0;
            switch (selecation) {
                case '1':
                    System.out.println("--------------------------------当前收支记录--------------");
                    System.out.print(details);
                    break;


                case '2':
                    System.out.print("---------------------------收入统计---------------");
                    System.out.print("请输入你的收入：");
                    int addMoney = Unitlity.readNumber();
                    System.out.print("请说明");
                    String info = Unitlity.readString();
                    balance += addMoney;
                    details += ("收入" + balance + "\t" + addMoney + "\t" + info);


                    System.out.println("----------------------登记完成-------------");
                    break;

                case '3':
                    System.out.print("---------------------------支出统计---------------");
                    System.out.print("请输入你的支出：");
                    int jianMoney = Unitlity.readNumber();
                    System.out.print("请说明");
                    info = Unitlity.readString();
                    balance -= jianMoney;
                    details += ("支出" + balance + "\t" + jianMoney + "\t" + info);
                    System.out.println("----------------------登记完成-------------");
                    break;
                case '4':
                    System.out.print("是否确定退出：Y/N");
                    char isExit = Unitlity.readConFirmSelection();
                    if (isExit == 'Y') {
                        isFlag = false;
                    }


            }

        }

    }
}
